from django.urls import path, include, re_path
from rest_framework import routers
from . import views

router = routers.DefaultRouter()
router.register(r'orders', views.OrderViewSet, basename='order')

urlpatterns = [
    path('', include(router.urls)),
    re_path(r'^orderscounts/$', views.OrdersCountView.as_view()),
    # path(r'^recentorders/<int:days>/', views.RecentOrdersView.as_view()),
    path('recentorders/<int:days>/', views.RecentOrdersView.as_view(), name='recent_orders'),
    path('ordersline/<int:days>/', views.OrdersLineView.as_view()),
    # 汇总某一天的订单数量，进行图表绘制
    re_path(r'^orderschart/$', views.OrdersChartView.as_view()),
    re_path(r'^ordersbyname/$', views.ordersbyname.as_view()),
    re_path(r'^getproductList/$', views.GetProductList.as_view()),
    re_path(r'^predict/$', views.PredictView.as_view()),

]
